/*******************************************************************************
* Project:         finance -- Home finance v2.0 
* Module:          Defition
* File Name:       financedef.h
* Author:          Rabbit Shi
* Start Date:      JUL. 13, 2005
* Language:        MFC 
* Target:		   PC
* Summary:         Define internal data struct
* Change Note:
* Copyright:       Copyright 2003-2005 Changjiang Shi and HanYuan
*                  All rights reserved.
********************************************************************************/

#ifndef	_FINANCEDEF_H  
#define _FINANCEDEF_H


// macro
#define		_OUT_OF_DATE_NOTIFY_


// for cross platform in Simplified Chinese and Traditional Chinese
#define WTK_ASCII			0x0000	/* 8 bit packing, ascii*/
#define WTK_UTF8			0x0001	/* 8 bit packing, utf8*/
#define WTK_UC16			0x0002	/* 16 bit packing, unicode 16*/	
#define WTK_UC32			0x0004	/* 32 bit packing, unicode 32*/

#define WTK_UNICODE 		WTK_UC16
#define WTK_GB2312			0x0100
#define WTK_GB				WTK_GB2312
#define WTK_BIG5			0x0200
#define WTK_SYS_CHARSET  	WTK_GB2312 //WTK_UNICODE ,because parser default is GB2312


#define		ACCOUNT_COLUMNS		6	// order by table( Account )
#define		BANKBOOK_COLUMNS	9	// order by table( Bankbook )

// filename for backup
#define		BACKUPFILE			"Mmoney_bak.mdb"

#define		MONEY_CFG				"financecfg.ini"
#define		INI_MAX_BUFLEN			(MAX_BUFFER_LEN - 100)		// ref to CDataFile.h

#define		FINANCEDAY			10	// begin date for finance

#define		MONEYEDIT_MAXLEN	30
#define		USERNAME_MAXLEN		10
#define		PASSWORD_MAXLEN		10


#define IDS_MAILADDR	_T("mailto:changjiang.shi@gmail.com")
#define IDS_WEBADDR		_T("http://blog.csdn.net/srbfly")
#define	IDS_REGSRBKEY	_T("SOFTWARE\\SRB soft\\Finance\\")		// Subkey in register


// For En/Decrypt		
#define IDS_PWDKEY		"Confidence"
#define IDS_DEFAULTPWD	"123456"
#define	DEFAULTPWD_LEN		50

#define IDS_BANKOP_STORE	"Store"
#define IDS_BANKOP_EXTRACT	"Extract"

// Must be sync with Flowclass table of "Mmoney.mdb"
//--------------------------------------------------
#define IDS_FC_EXPESE	"Expense"
#define IDS_FC_INCOME	"Income"
#define IDS_FC_BANK		"Bank"
#define IDS_FC_INVEST	"Invest"


// state for Listctrl display
typedef enum displayorder
{
	asc = 0,	// 
	desc		// default
}DISPORDER;


// for Bankbook table
typedef enum bankorderbycolumn
{
	bank_name = 0,	
	certificate,
	bank_account,		
	bank_rate,	
	bank_startdate,	// default
	bank_enddate,	
	bank_operation,
	bank_owner,	
	bank_comment	
	
}BANKORDERCOLUMN;


// for Account table
typedef enum orderbycolumn
{
	amount = 0,
	purpose,	// 1
	flowclass,	// 2
	date,		// default
	owner,		// 4
	comment		// 5

}ORDERCOLUMN;


typedef enum typeofrange
{
	all = 0,	//
	half_year,	// 1
	month,		// 2
	user		// 3
		
}RANGETYPE;


// name , width for every columns
typedef struct lsv_colmun 
{
	CHAR	chName[20];
	INT		iFormat;
	INT		iWidth;
	
	BYTE	btImgFlag:1;	// 0/1 : has img/no img
	BYTE	btmgIdx:7;		// index of image list, [0~127]
	
	
}PTLVCOL;




// global vars
extern	PTLVCOL		g_myColumn[ACCOUNT_COLUMNS];	// the array order is same as ORDERCOLUMN define
extern	PTLVCOL		g_BankColumn[BANKBOOK_COLUMNS];



// global functions
//---------------------------------------------------------------------------
INT		wtkGetSysLanguage( void );

CTime	DTString2CTime( CString &CsTime );

void	GetAPDefaultPwd( LPTSTR pchEncrypted );

void	OnExecHelper();


#endif	// _FINANCEDEF_H
